<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>uimaker信息管理系统</title> 
    <link href="#(ctx)/static/css/base.css" rel="stylesheet">
    <link href="#(ctx)/static/css/login/login.css" rel="stylesheet">
	<script src="#(ctx)/static/js/jquery.min.js"></script>
	<script src="#(ctx)/static/layer/layer.js"></script>
	<script src="#(ctx)/static/js/jquery.cookie.js"></script>
	
</head> 
<body>
	<div class="login-hd">
		<div class="left-bg"></div>
		<div class="right-bg"></div>
		<div class="hd-inner">
			<span class="logo"></span>
			<span class="split"></span>
			<span class="sys-name">报名系统</span>
		</div>
	</div>
	<div class="login-bd">
		<div class="bd-inner">
			<div class="inner-wrap">
				<div class="lg-zone">
					<div class="lg-box">
						<div class="lg-label"><h4>用户登录</h4></div>
						
						<form>
							<div class="lg-username input-item clearfix">
								<i class="iconfont">&#xe60d;</i>
								<input type="text" placeholder="账号/邮箱" id="username">
							</div>
							<div class="lg-password input-item clearfix">
								<i class="iconfont">&#xe634;</i>
								<input type="password" placeholder="请输入密码" id="password">
							</div>
							<div class="lg-check clearfix">
								<div class="input-item">
									<i class="iconfont">&#xe633;</i>
									<input type="text" placeholder="验证码" id="captchaCode">
								</div>
								<img class="check-code" id="captcha" src="#(ctx)/admin/login/captcha"/>
							</div>
							<div class="tips clearfix">
								<label><input id="jz" type="checkbox" checked="checked">记住用户名</label>
								
							</div>
							<div class="enter">
								<a href="javascript:voide;" id="loginBtn" class="purchaser" >立即登录</a>
							</div>
						</form>
					</div>
				</div>
				<div class="lg-poster"></div>
			</div>
		</div>
	</div>
	<div class="login-ft">
		<div class="ft-inner">
			<div class="about-us">
				<a href="javascript:;">关于我们</a>
				<a href="javascript:;">法律声明</a>
				<a href="javascript:;">服务条款</a>
				<a href="javascript:;">联系方式</a>
			</div>
			<div class="address">地址：江苏省南京市雨花台区软件园&nbsp;邮编：210019&nbsp;&nbsp;Copyright&nbsp;©&nbsp;2015&nbsp;-&nbsp;2016&nbsp;uimaker-专注于ui设计&nbsp;版权所有</div>
			<div class="other-info">建议使用IE8及以上版本浏览器&nbsp;苏ICP备&nbsp;09003078号&nbsp;E-mail：admin@uimaker.com</div>
		</div>
	</div>
</body> 
</html>
    
<script type="text/javascript">
	$(function(){
		$("#captcha").on("click",function(){
			$("#captcha").attr("src","#(ctx)/admin/login/captcha?t="+new Date().getTime());
		});
		$(document).keyup(function(event){
		  if(event.keyCode ==13){
			  login();
		  }
		});
		$("#loginBtn").click(function(){
			login();
		});
		if($.cookie('username')){
			$("#username").val($.cookie('username'));
		}
		if($.cookie('password')){
			$("#password").val($.cookie('password'));
		}
	});
	function login(){
		var username=$("#username").val();
		var password=$("#password").val();
		var captchaCode=$("#captchaCode").val();
		if(username==""){
			layer.tips('请输入用户名', '#username');
			$("#username").focus();
			return;
		}
		if(password==""){
			layer.tips('请输入密码', '#password');
			$("#password").focus();
			return;
		}
		if(captchaCode==""){
			layer.tips('请输入验证码', '#captchaCode');
			$("#captchaCode").focus();
			return;
		}
		var data={username:username,password:password,captchaCode:captchaCode};
		$.post("#(ctx)/admin/login/ajaxlogin",data,function(data){
			layer.msg(data.msg);
			if(data.code==0){
				setTimeout(function(){
					window.location.href="#(ctx)/admin";
				},1000);
				jz();
			}
		},'json');
	}
	function jz(){
		if($('#jz').is(':checked')) {
			var username=$("#username").val();
			var password=$("#password").val();
			$.cookie('username', username, { expires: 7, path: '/' });
			$.cookie('password', password, { expires: 7, path: '/' }); 
		}else{
			$.cookie('username', null);
			$.cookie('password', null);
		}
	}
</script>
